<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<link rel="shortcut icon" href="${contextPath}/images/favicon.ico" />
<link href="${contextPath}/styles/default.css" rel="stylesheet" type="text/css" />
<link href="${contextPath}/styles/logon.css" rel="stylesheet" type="text/css" />
<script src="${contextPath}/scripts/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>登陆-合格证风险管理系统</title>

<script type="text/javascript">
function formSubmit() {
	if($('#nameField').val() == '') {
		$('#nameField').focus();
		$('#msg').addClass('login_error_box');
		$('#msg').text('用户名不能为空');
		return;
	}
	if($('#passwordField').val() == '') {
		$('#passwordField').focus();
		$('#msg').addClass('login_error_box');
		$('#msg').text('密码不能为空');
		return;
	}
	
	$('#loginForm').submit();
	
}

$(document).ready(function() {
		if(top.location != self.location) {
			top.location = self.location;
		}
		$('#nameField').focus();
		$('#loginField').click(formSubmit);
		document.onkeydown = keyEnter; 
}
)

function keyEnter(){ 
        if(event.keyCode == 13)   { 
        	formSubmit();
        }   
} 


</script>
</head>
<%
Cookie cookies[] = request.getCookies();
String userName = "";
String password = "";
if (cookies != null) {
	for (int i = 0; i < cookies.length; i++) {
		if ("cnsys.user".equals(cookies[i].getName())) {
			userName = cookies[i].getValue();
		}else if("cnsys.password".equals(cookies[i].getName())){
			if("cnsys.password" != null){
				password = cookies[i].getValue();
			}
			
		}
	}
}
pageContext.setAttribute("userName", userName);
pageContext.setAttribute("password", password);
%>
<body>
 <form name="form1" id="loginForm" method="post" action="${contextPath}/login.do">
<div class="dl_main">
  <div class="dl_main_nei">
    <div class="dl_main_nei_kuai">
   
	      <table width="100%" border="0" cellspacing="0" cellpadding="0">
	 	    <tr>
	  		  <td height="45" colspan="2" align="center" valign="middle"><input name="userInfo.name" value="${userName}" id="nameField" type="text" class="dl_main_nei_kuai_input"/></td>
		    </tr>
	 	    <tr>
	 	      <td height="45" colspan="2" align="center" valign="middle"><input id="passwordField" value="${password}"  type="password" name="userInfo.password" class="dl_main_nei_kuai_password"/></td>
	        </tr>
	 	    <tr>
	    	  <td width="50%" height="50"><input name="remember" type="checkbox" checked="checked" class="dl_main_nei_kuai_checkbox"/>记住密码</td>
	  		  <td width="50%" height="50"><input id="loginField" type="button" class="dl_main_nei_kuai_button"/></td>
	 	    </tr>
	 	    <tr>
	 	    	<td colspan="2" align="center" valign="middle">
	 	    		<span style="color:red;" id="msg"></span>
	 	    	</td>
	 	    </tr>
		  </table>
    </div>
  </div>
</div>
  </form>
</body>
</html>
